//
//  DispatchTopView.m
//  cocoapodText
//
//  Created by apple on 16/10/19.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ShiPei.h"
#import "DispatchTopView.h"
#import <Foundation/Foundation.h>

@interface DispatchTopView()
@end

@implementation DispatchTopView
/**
 *  初始化视图属性
 *
 *  @param frame 视图frame
 *
 *  @return self
 */
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //定制View
        self.backgroundColor = [UIColor clearColor];
        self.userInteractionEnabled = YES; //设置为NO后，不再响应touch方法
        self.multipleTouchEnabled = YES;
        //控制子视图不能超出父视图的范围
        self.clipsToBounds = YES;
        //添加子视图
        [self subView];
    }
    return self;
}

//子视图懒加载
-(void)subView{
    UIView *allBackView=[[UIView alloc]initWithFrame:[ShiPei CGRectMakeScale:10 :0 :760 :35]];
    [self addSubview:allBackView];
    [allBackView setUserInteractionEnabled:YES];
    [allBackView setBackgroundColor:FUIColorFromRGB(0x639ed7)];
    self.allBackView=allBackView;
    //名称100
    UILabel *itemName=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:20 :0 :140 :35]];
    [allBackView addSubview:itemName];
    [itemName setBackgroundColor:[UIColor clearColor]];
    [itemName setText:@""];
    [itemName setTextColor:[UIColor whiteColor]];
    [itemName setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemName setTextAlignment:NSTextAlignmentLeft];
    self.itemName=itemName;
    //类型100
    UILabel *itemType=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:160 :0 :50 :35]];
    [allBackView addSubview:itemType];
    [itemType setBackgroundColor:[UIColor clearColor]];
    [itemType setText:@""];
    [itemType setTextColor:[UIColor whiteColor]];
    [itemType setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemType setTextAlignment:NSTextAlignmentLeft];
    self.itemType=itemType;
    
    //方案标识100
    UILabel *itemLoad=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:210 :0 :140 :35]];
    [allBackView addSubview:itemLoad];
    [itemLoad setBackgroundColor:[UIColor clearColor]];
    [itemLoad setText:@""];
    [itemLoad setTextColor:[UIColor whiteColor]];
    [itemLoad setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemLoad setTextAlignment:NSTextAlignmentLeft];
    self.itemLoad=itemLoad;
    
    // 累计调度小时数100
    UILabel *itemNumber=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:350 :0 :100 :35]];
    [allBackView addSubview:itemNumber];
    [itemNumber setBackgroundColor:[UIColor clearColor]];
    [itemNumber setText:@""];
    [itemNumber setTextColor:[UIColor whiteColor]];
    [itemNumber setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemNumber setTextAlignment:NSTextAlignmentLeft];
    self.itemNumber=itemNumber;
    
    
    //承诺降负荷100
    UILabel *itemPrice=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:450 :0 :100 :35]];
    [allBackView addSubview:itemPrice];
    [itemPrice setBackgroundColor:[UIColor clearColor]];
    [itemPrice setText:@""];
    [itemPrice setTextColor:[UIColor whiteColor]];
    [itemPrice setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemPrice setTextAlignment:NSTextAlignmentLeft];
    self.itemPrice=itemPrice;
    
    
    //实际降负荷100
    UILabel *itemStartTime=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:550 :0 :100 :35]];
    [allBackView addSubview:itemStartTime];
    [itemStartTime setBackgroundColor:[UIColor clearColor]];
    [itemStartTime setText:@""];
    [itemStartTime setTextColor:[UIColor whiteColor]];
    [itemStartTime setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemStartTime setTextAlignment:NSTextAlignmentLeft];
    self.itemStartTime=itemStartTime;
    
    //完成率80
    UILabel *itemEndTime=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:650 :0 :55 :35]];
    [allBackView addSubview:itemEndTime];
    [itemEndTime setBackgroundColor:[UIColor clearColor]];
    [itemEndTime setText:@""];
    [itemEndTime setTextColor:[UIColor whiteColor]];
    [itemEndTime setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemEndTime setTextAlignment:NSTextAlignmentLeft];
    self.itemEndTime=itemEndTime;
    
    //内容80
    UILabel *itemContent=[[UILabel alloc]initWithFrame:[ShiPei CGRectMakeScale:705 :0 :55 :35]];
    [allBackView addSubview:itemContent];
    [itemContent setBackgroundColor:[UIColor clearColor]];
    [itemContent setText:@""];
    [itemContent setTextColor:[UIColor whiteColor]];
    [itemContent setFont:[UIFont boldSystemFontOfSize:[ShiPei CGFloatMakeFontScaleWithPX:23]]];
    [itemContent setTextAlignment:NSTextAlignmentLeft];
    self.itemContent=itemContent;
}

-(void)setName:(NSString *)name{
    [self.itemName setText:name];
}

-(void)setType:(NSString *)type{
    [self.itemType setText:type];
}

-(void)setLoad:(NSString *)load{
    [self.itemLoad setText:load];
}

-(void)setNumber:(NSString *)number{
    [self.itemNumber setText:number];
}

-(void)setPrice:(NSString *)price{
    [self.itemPrice setText:price];
}

-(void)setStartTime:(NSString *)startTime{
    [self.itemStartTime setText:startTime];
}

-(void)setEndTime:(NSString *)endTime{
    [self.itemEndTime setText:endTime];
}

-(void)setContent:(NSString *)content{
    [self.itemContent setText:content];
}




@end
